package com.qcby.community.mapper;

import com.qcby.community.entity.InOutRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qcby.community.vo.ChartVO;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author admin
 * @since 2024-03-25
 */
@Repository
public interface InOutRecordMapper extends BaseMapper<InOutRecord> {

    @Select("SELECT COUNT(*) VALUE,c.community_name NAME FROM community c,person p WHERE c.community_id = p.community_id GROUP BY c.community_id")
    public List<ChartVO> chart();

    @Select("select * from in_out_record where community_id=#{communityId} and person_id=#{personId} and out_time is null")
    public InOutRecord getInOutRecord(InOutRecord inOutRecord);
}
